<?php

class DB
{
    private static $servername = "localhost";
    private static $username = "root";
    private static $password = "root";
    private static $dbname = "exp4";

    public static function getConnector() {
        $conn = new mysqli(DB::$servername, DB::$username, DB::$password, DB::$dbname);
        // 检测连接
        if ($conn->connect_error) {
            die("Connection failed: " . mysqli_connect_error());
        }
        return $conn;
    }

    public static function getSpecialConn() {
        $conn = mysqli_connect(self::$servername, self::$username, self::$password, self::$dbname);
        return $conn;
    }
}